import React, { Component } from 'react';
import { connect } from 'react-redux'
import { Modal, Form, Input, Select, Table, InputNumber, DatePicker, Popconfirm, Radio, Row, Col, } from 'antd';
import moment from 'moment'
const RadioGroup = Radio.Group;
const FormItem = Form.Item;
const Option = Select.Option;

class EditRemarkModal extends Component {
    constructor(props) {
        super(props);
        this.state = {
            visible: false,
        };
    }

    okHandler = () => {
        const { addScrapDetailHandle } = this.props;
        this.props.form.validateFields((err, values) => {
            if (!err) {
                addScrapDetailHandle(values);
                this.props.form.resetFields();
            }
        });
    };
    render() {
        const { children, dispatch, title, item, rackList } = this.props;
        const { getFieldDecorator } = this.props.form;
        const formItemLayout = {
            labelCol: { span: 6 },
            wrapperCol: { span: 14 },
        };


        return (
            <span>
                <Modal
                    maskClosable={this.props.maskClosable}
                    confirmLoading={this.props.confirmLoading}
                    zIndex={200}
                    title={this.props.title + '\t' + '(资产编号:' + item.assetNo + '\t' + '资产名称：' + item.assetName + ')'}
                    visible={this.props.visible}
                    //   width={1000}
                    onOk={this.okHandler}
                    onCancel={this.props.onCancel}
                    key={this.props.newKey}
                >
                    {/* <div style={{width:'auto',height:document.body.clientHeight - 400,position:'relative',backgroundColor:'#fff'}}>
                <div style={{minHeight:'100%'}}>
                <div style={{width:'100%',backgroundColor:'#fff',paddingLeft:'20px'}}>
                    <Form layout={'inline'} style={{marginTop: '0px'}}>
                    <FormItem style={{marginBottom:'0px'}}>
                        {getFieldDecorator('detailId',{initialValue:item.id_})(
                        <Input type="hidden"/>
                        )}
                    </FormItem>
                        <Row gutter={16}>
                            <Col span={6}>
                                <FormItem
                                    label="资产编号"
                                >
                                {
                                    getFieldDecorator('assetNo', {
                                    initialValue: item.assetNo,
                                    })(<Input readOnly="readonly" style={{ width: '140px' }} />)
                                }
                                </FormItem>
                            </Col>
                            <Col span={6}>
                                <FormItem
                                    label="设备名称"
                                    >
                                    {getFieldDecorator('assetName', {
                                        initialValue: item.assetName,
                                    })(<Input readOnly="readonly" style={{ width: '140px' }} />)}
                                </FormItem>
                            </Col>
                            <Col span={6}>
                                <FormItem
                                    label="设备序列号"
                                    >
                                    {getFieldDecorator('serialNo', {
                                        initialValue: item.serialNo,
                                    })(<Input readOnly="readonly" style={{ width: '120px' }} />)}
                                </FormItem>
                            </Col>
                            <Col span={6}>
                                <FormItem
                                    label="RFID编码"
                                    >
                                    {
                                    getFieldDecorator('rfidNo', {
                                        initialValue: item.rfidNo,
                                    })( <Input readOnly="readonly" style={{ width: '140px' }}/>)
                                    }
                                </FormItem>
                            </Col>
                        </Row>

                        <Row style={{marginTop:'20px'}}>
                            <Col span={24}>
                                <FormItem
                                    label="备注"
                                    hasFeedback
                                 >
                                    {
                                    getFieldDecorator('remark', {
                                        initialValue: item.detailRemark,
                                        rules: [{ max: 200, message: '备注信息 200 字符以内' },]
                                        })(<Input style={{ width: '890px' }} type="textarea" autosize={{ minRows: 4, maxRows: 4 }}/>)
                                    }
                                </FormItem>
                            </Col>
                      </Row>
                </Form>
                </div>
                </div>
            </div> */}
                    <FormItem style={{ marginBottom: '0px' }}>
                        {getFieldDecorator('detailId', { initialValue: item.id_ })(
                            <Input type="hidden" />
                        )}
                    </FormItem>
                    <FormItem>
                        {
                            getFieldDecorator('remark', {
                                initialValue: item.detailRemark,
                                rules: [{ max: 200, message: '备注信息 200 字符以内' },]
                            })(<Input type="textarea" autosize={{ minRows: 4, maxRows: 4 }} />)
                        }
                    </FormItem>
                </Modal>

            </span>
        );
    }

}

export default Form.create()(EditRemarkModal)
